<?php

namespace App\depository;

use App\Enum\CommonEnum;
use App\Models\SteamIDEosidModel;

class SteamIDEosidDep
{
    public $model;
    const STATUS_ON = 1; //启用
    const STATUS_OFF = 2; //禁用

    public function __construct(){
        $this->model = new SteamIDEosidModel();
    }

    public function add($data){
        return $this->model->insert($data);
    }

    public function get_fields($fields = [], $fields_key = '', $fields_val = ''){

        return $this->model->select($fields)->where($fields_key, $fields_val)->where("status", self::STATUS_ON)->first();
    }

    public function firstBySteamid($steamid){
        $res = $this->model->where('steamid',$steamid)->where('status',CommonEnum::YES)->first();
        return $res;
    }
}
